{% extends "base.html" %}
{% block menu %}
	
 <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="brand" href="#">Project Manager System</a>
          <div class="nav-collapse collapse">
            <ul class="nav">
              <li><a href="/admitem/{{session['faseid']}}">Administrar Item</a></li>
              <li><a href="/">Logout</a></li>
			<li><a href="#contact">Usuario: {{session['username']}}</a></li>
              </ul>
          </div>
       </div>
     </div>
</div>
{%endblock%}


{%block mensaje%}

{%endblock%}

{%block content%}
<div class="container">
	<h3 class="muted" align="center">{{session['proyectonombre']}} - {{session['fasenombre']}}</h3>
	<h3>Completar Atributo</h3>
	<hr>
	<p>Complete los datos de los Atributos</p>
	<form action="{{url_for('completaratributo')}}" method="post">
	<div class="span5">
	<table  class="table  table-bordered" >
								<tr>
                                    <th>Atributo</th>
                                    <th>Valor</th>
                                 </tr>
                                 
                                 
                              {% set i =1%}
            {% for a in atributos %}
            <tr>   
            	<td>{{a.nombre}}</td>
            	{% for v in valores %}
            		{% if v.atributo_id == a.id %}
            			{% set aux = v.valor %}
            			{% if a.tipoDato == "Cadena" %}
		            		<td><input type="text" name="{{a.nombre}}" value="{{aux}}"/></td>
		            	{% endif %}
		            	{% if a.tipoDato == "Numerico" %}
		            		<td><input type="number" name="{{a.nombre}}" value="{{aux}}"/></td>
		            	{% endif %}
		            	{% if a.tipoDato == "Fecha" %}
		            		{%if aux%}
		            			<td><input type="date" name="{{a.nombre}}" value="{{aux.strftime('%Y-%m-%d')}}"/></td>
		            		{%else%}
		            			<td><input type="date" name="{{a.nombre}}" value="{{aux}}"/></td>
		            		{%endif%}
		            	{% endif %}
		            	{% if a.tipoDato == "Booleano" %}
		            		{% if aux %}
		            		<td><input type="checkbox" name="{{a.nombre}}" checked/></td>
		            		{%else%}
		            		<td><input type="checkbox" name="{{a.nombre}}" /></td>
		            		{% endif %}
	            		{% endif %}
            		{% endif %}
            	{% endfor%}
           </tr> 
           {% else %}
	       <tr>
	            <td>
	          		El tipo de item no consta de atributos propios
	          	</td>
          		<td></td>
          	</tr>
          	{%endfor%}
        </table>
            <p><input class="btn btn-success" type="submit" value="Aceptar" />
            <a class="btn btn-inverse" href="/admitem/{{session['faseid']}}">Cancelar</a></p>
        
    	</div>
    </form>
</div>
{%endblock%}		
